home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 14288 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.9 KB  |  109 lines

  1. Path: athena.ulaval.ca!news
  2. From: Ferid Baklouti <baklouti@ift.ulaval.ca>
  3. Newsgroups: comp.lang.c
  4. Subject: HELP...HELP
  5. Date: Fri, 12 Apr 1996 20:34:41 -0400
  6. Organization: Universite Laval
  7. Message-ID: <316EF6A1.41C6@ift.ulaval.ca>
  8. NNTP-Posting-Host: pegase.ift.ulaval.ca
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-Mailer: Mozilla 2.0 (X11; I; IRIX 5.3 IP22)
  13.  
  14. Hello everyone,
  15.  
  16. imagine this command under a unix system :
  17.  
  18.     program1 < file | program2 | program3 > file.results
  19.  
  20. i want the "program2" to be able to detect the name of "file" given on
  21. the standard input <stdin> to the program1.
  22.  
  23.  
  24.  
  25. in the file stdio.h, I only find the things below which doesn't contain
  26. the name of the file.
  27.  
  28. -----------------------------------------------------------------------
  29.  
  30.  
  31.  more stdio.h
  32. /*      @(#)stdio.h 1.16 89/12/29 SMI; from UCB 1.4 06/30/83    */
  33.  
  34. # ifndef FILE
  35. #define BUFSIZ  1024
  36. #define _SBFSIZ 8
  37. extern  struct  _iobuf {
  38.         int     _cnt;
  39.         unsigned char *_ptr;
  40.         unsigned char *_base;
  41.         int     _bufsiz;
  42.         short   _flag;
  43.         char    _file;          /* should be short */
  44. } _iob[];
  45.  
  46. #define _IOFBF  0
  47. #define _IOREAD 01
  48. #define _IOWRT  02
  49. #define _IONBF  04
  50. #define _IOMYBUF        010
  51. #define _IOEOF  020
  52. #define _IOERR  040
  53. #define _IOSTRG 0100
  54. #define _IOLBF  0200
  55. #define _IORW   0400
  56. #define NULL    0
  57. #define FILE    struct _iobuf
  58. #define EOF     (-1)
  59.  
  60. #define stdin   (&_iob[0])
  61. #define stdout  (&_iob[1])
  62. #define stderr  (&_iob[2])
  63.  
  64. #ifdef lint     /* so that lint likes (void)putc(a,b) */
  65. extern int putc();
  66. extern int getc();
  67. #else
  68. #define getc(p)         (--(p)->_cnt>=0? ((int)*(p)->_ptr++):_filbuf(p))
  69. #define putc(x, p)      (--(p)->_cnt >= 0 ?\
  70.         (int)(*(p)->_ptr++ = (unsigned char)(x)) :\
  71.         (((p)->_flag & _IOLBF) && -(p)->_cnt < (p)->_bufsiz ?\
  72.                 ((*(p)->_ptr = (unsigned char)(x)) != '\n' ?\
  73.                         (int)(*(p)->_ptr++) :\
  74.                         _flsbuf(*(unsigned char *)(p)->_ptr, p)) :\
  75.                 _flsbuf((unsigned char)(x), p)))
  76. #endif
  77. #define getchar()       getc(stdin)
  78. #define putchar(x)      putc((x),stdout)
  79. #define feof(p)         (((p)->_flag&_IOEOF)!=0)
  80. #define ferror(p)       (((p)->_flag&_IOERR)!=0)
  81. #define fileno(p)       ((p)->_file)
  82. #define clearerr(p)     (void) ((p)->_flag &= ~(_IOERR|_IOEOF))
  83.  
  84. extern FILE     *fopen();
  85. extern FILE     *fdopen();
  86. extern FILE     *freopen();
  87. extern FILE     *popen();
  88. extern FILE     *tmpfile();
  89. extern long     ftell();
  90. extern char     *fgets();
  91. extern char     *gets();
  92. extern char     *sprintf();
  93. extern char     *ctermid();
  94. extern char     *cuserid();
  95. extern char     *tempnam();
  96. extern char     *tmpnam();
  97.  
  98. #define L_ctermid       9
  99. #define L_cuserid       9
  100. #define P_tmpdir        "/usr/tmp/"
  101. #define L_tmpnam        25              /* (sizeof(P_tmpdir) + 15) */
  102. # endif
  103.  
  104. -----------------------------------------------------------------------
  105.  
  106. thanks a lot.
  107.  
  108. Ferid
  109.